#ifndef _CPUINFO_H_
#define _CPUINFO_H_

#include <arch/types.h>

struct CPUType {
	dword unused	:4;
	byte efamily;
	dword emodel	:4;
	dword unused2	:2;
	dword type	:2;
	dword family	:4;
	dword model	:4;
	dword stepping	:4;
};

struct CPUBrand {
	byte APICID;
	byte CPUCount;
	byte CLFLUSH;
	byte BrandID;
};

struct CPUFeatures0 {
	dword FPU	:1;
	dword VME	:1;
	dword DE	:1;
	dword PSE	:1;
	dword TSC	:1;
	dword MSR	:1;
	dword PAE	:1;
	dword MCE	:1;
	dword CX8	:1;
	dword APIC	:1;
	dword Reserved	:1;
	dword SEP	:1;
	dword MTRR	:1;
	dword PGE	:1;
	dword MCA	:1;
	dword CMOV	:1;
	dword PAT	:1;
	dword MSE36	:1;
	dword PSN	:1;
	dword CLFL	:1;
	dword Reserved2	:1;
	dword DTES	:1;
	dword ACPI	:1;
	dword MMX	:1;
	dword FXSR	:1;
	dword SSE	:1;
	dword SSE2	:1;
	dword SS	:1;
	dword HTT	:1;
	dword TM1	:1;
	dword IA64	:1;
	dword PBE	:1;
};

struct CPUFeatures1 {
};

class CPUInfo {
public:
	static int GetInformations();

	static char Vendor[12];
	static char Name[48];
	static struct CPUType Type;
	static struct CPUBrand Brand;
	static struct CPUFeatures0 Features0;
	static struct CPUFeatures1 Features1;

	static struct {
	} Features2;

	static struct {
	} Features3;

private:
	static void CPUID(dword *eax, dword *ebx, dword *ecx, dword *edx);
	static int GetVendor();
	static void GetProcessorName();
	static void GetFeatures();
	static void GetExtendedFeatures();
	static int GetMaxExtendedLevel();

	static int maxLevel, maxExtendedLevel;
};

#endif
